package ran.youling.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import ran.youling.pojo.User;
import ran.youling.service.impl.UserService;

import ran.youling.util.Result;

import java.util.Map;

/***
 * NAME:Ran
 * TIME:2025/1/12
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @GetMapping("/index")
    public String index() {
        return "欢迎访问首页";
    }

    //    用户注册的方法
    @PostMapping("/enroll")
    public String userEnroll(@RequestBody User user) {
        return userService.enroll(user);
    }

    //    模拟用户登录
    @PostMapping("/login")
    public Result<Map<String, String>> login(@RequestBody User user) {
        return userService.login(user);
    }


}
